package com.labichaoka.chaoka.ui.credit;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.labichaoka.chaoka.R;
import com.labichaoka.chaoka.base.BaseActivity;
import com.labichaoka.chaoka.base.MyApplication;
import com.labichaoka.chaoka.entity.LimitStatusResponse;
import com.labichaoka.chaoka.ui.MainActivity;
import com.labichaoka.chaoka.utils.ToastUtils;

import butterknife.BindView;
import butterknife.OnClick;

/*
* 种子用户额度页面
*
* */

public class PersonalCreditActivity extends BaseActivity implements PersonalCreditView{

    @BindView(R.id.amount)
    TextView amount;

    private PersonalCreditPresenter presenter;

    @Override
    protected int initLayoutId() {
        return R.layout.activity_personal_credit;
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void initData() {
        presenter=new PersonalCreditPresenterImpl(new PersonalCreditInteractorImpl(),this);
        presenter.calculate();
    }

    @OnClick(R.id.back)
    public void click(View v){
        MyApplication.finishAllActivityExceptMain(MainActivity.class);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public void showProgress() {
        showLoadingProgress();
    }

    @Override
    public void hideProgress() {
        hideLoadingProgress();
    }

    @Override
    public void showMessage(String str) {
        ToastUtils.show(str);
    }

    @Override
    public void setData(LimitStatusResponse response) {
        amount.setText("￥"+response.getData().getTotalQuota());
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        presenter.onDestroy();
    }
}
